What is @commitlint/types?
@commitlint/types is a TypeScript type definitions package for Commitlint, a tool used to enforce conventional commit messages. It provides type definitions for various Commitlint configurations, rules, and utilities, ensuring type safety and better development experience when working with Commitlint.
What are @commitlint/types's main functionalities?
Commitlint Configuration Types
Defines the configuration for Commitlint using the provided type definitions. This ensures that the configuration adheres to the expected structure and types.
const config: import('@commitlint/types').UserConfig = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']]
}
};
Commitlint Rule Types
Defines a custom rule for Commitlint using the provided type definitions. This ensures that the rule function adheres to the expected signature and types.
const rule: import('@commitlint/types').Rule = (parsed, when, value) => {
return [true, 'Commit message is valid'];
};
Commitlint Parser Options Types
Defines parser options for Commitlint using the provided type definitions. This ensures that the parser options adhere to the expected structure and types.
const parserOpts: import('@commitlint/types').ParserOptions = {
headerPattern: /^([A-Z]+-[0-9]+): (.*)$/,
headerCorrespondence: ['type', 'subject']
};
Other packages similar to @commitlint/types
conventional-changelog
Conventional Changelog is a suite of tools to parse conventional commit messages and generate changelogs. It provides similar functionalities to Commitlint but focuses more on generating changelogs rather than enforcing commit message conventions.
commitizen
Commitizen is a tool that helps developers write standardized commit messages. It provides a command-line interface to guide users through the commit message creation process, ensuring adherence to conventional commit standards. Unlike Commitlint, it focuses on the commit message creation process rather than validation.
semantic-release
Semantic Release automates the versioning and package publishing process based on commit messages. It uses conventional commit messages to determine the type of release (major, minor, patch) and generates release notes. While it shares the goal of standardizing commit messages, it extends beyond validation to automate the release process.